package com.citicup.backend.entity;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "user", schema = "citicup2020")
public class User {
    private Integer id;
    private String username;
    private String password;
    private Double subjectiveRiskPreference;
    private Double stopProfit;
    private Double stopLoss;
    private Integer plannedInvestmentCycle;
    private Integer plannedTotalInvestmentAmount;
    private Double objectiveInvestmentStrength;

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public User() {
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    public Integer getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "username")
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Basic
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "subjective_risk_preference")
    public Double getSubjectiveRiskPreference() {
        return subjectiveRiskPreference;
    }

    public void setSubjectiveRiskPreference(Double riskAssessmentIndex) {
        this.subjectiveRiskPreference = riskAssessmentIndex;
    }

    @Basic
    @Column(name = "stop_profit")
    public Double getStopProfit() {
        return stopProfit;
    }

    public void setStopProfit(Double stopProfit) {
        this.stopProfit = stopProfit;
    }

    @Basic
    @Column(name = "stop_loss")
    public Double getStopLoss() {
        return stopLoss;
    }

    public void setStopLoss(Double stopLoss) {
        this.stopLoss = stopLoss;
    }

    @Basic
    @Column(name = "planned_investment_cycle")
    public Integer getPlannedInvestmentCycle() {
        return plannedInvestmentCycle;
    }

    public void setPlannedInvestmentCycle(Integer plannedInvestmentCycle) {
        this.plannedInvestmentCycle = plannedInvestmentCycle;
    }

    @Basic
    @Column(name = "planned_total_investment_amount")
    public Integer getPlannedTotalInvestmentAmount() {
        return plannedTotalInvestmentAmount;
    }

    public void setPlannedTotalInvestmentAmount(Integer plannedTotalInvestmentAmount) {
        this.plannedTotalInvestmentAmount = plannedTotalInvestmentAmount;
    }

    @Basic
    @Column(name = "objective_investment_strength")
    public Double getObjectiveInvestmentStrength() {
        return objectiveInvestmentStrength;
    }

    public void setObjectiveInvestmentStrength(Double plannedInvestmentIncome) {
        this.objectiveInvestmentStrength = plannedInvestmentIncome;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        User that = (User) o;
        return id.equals(that.id) &&
                Objects.equals(username, that.username) &&
                Objects.equals(password, that.password) &&
                Objects.equals(subjectiveRiskPreference, that.subjectiveRiskPreference) &&
                Objects.equals(stopProfit, that.stopProfit) &&
                Objects.equals(stopLoss, that.stopLoss) &&
                Objects.equals(plannedInvestmentCycle, that.plannedInvestmentCycle) &&
                Objects.equals(plannedTotalInvestmentAmount, that.plannedTotalInvestmentAmount) &&
                Objects.equals(objectiveInvestmentStrength, that.objectiveInvestmentStrength);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username, password, subjectiveRiskPreference, stopProfit, stopLoss, plannedInvestmentCycle, plannedTotalInvestmentAmount, objectiveInvestmentStrength);
    }
}
